package extendsDemo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 阿宾
 * Date: 2025-03-11
 * Time: 09:21
 */

//父类
class Fu{
    String name;
    private int age;
    public Fu(){}
    public Fu(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
}
//子类
class Zi extends Fu{
    String game;
}
public class Test {
    public static void main(String[] args) {
        //利用空参构造方法
        Zi zi = new Zi();
        zi.setAge(23);
        zi.name = "zahngsan";
        zi.game = "游戏";
        System.out.println(zi.getAge() +","+zi.name+","+zi.game);
    }
}
